package com.fagertveit.android.game.cb;

import java.util.ArrayList;
import java.util.List;

import com.fagertveit.android.game.framework.gl.SpriteBatcher;

public class Level {
	private String title;
	private List<RectangularBrick> bricks;
	
	public Level() {
		float x, y;
		x = 18;
		y = 32;
		bricks = new ArrayList();
		RectangularBrick brick;
		
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 12; j++) {
				//brick = new RectangularBrick(1, 1, 200, x, y, 35, 17);
				bricks.add(new RectangularBrick(1, 1, 200, x, y, 35, 17));
				x += 36;
			}
			x = 18;
			y += 18;
		}
	}
	
	public void removeBrick(int i) {
		bricks.remove(i);
	}
	
	public RectangularBrick getBrick(int i) {
		return bricks.get(i);
	}
	
	public List<RectangularBrick> getBricks() {
		return bricks;
	}
	
	public void render(SpriteBatcher batcher) {
		
		batcher.beginBatch(Assets.gameGfx);
		for(int i = 0; i < bricks.size(); i++) {
			RectangularBrick brick = (RectangularBrick) bricks.get(i);
			batcher.drawSprite(brick.getDrawX(), brick.getDrawY(), brick.getWidth(), brick.getHeight(), Assets.brick);
		}
		batcher.endBatch();
	}
}
